const mongoose = require('mongoose')

const Schema = mongoose.Schema

mongoose.connect("mongodb://localhost/graproject", { useNewUrlParser: true })

//回复表

var replySchema = new Schema({
    reply_id:{// 该id与from_id相同 即为它的回复
        type: String,
        required: true
    },
    //目标用户信息
    from_to_img:{//目标评论的头像
        type: String,
        required: true
    },
    from_to_name:{//目标评论的用户名
        type: String,
        required: true
    },

    reply_to_id:{//回复评论的id  根据该id可以删除该评论
        type: String,
        required: true
    },
    reply_to_img:{//目标评论的头像
        type: String,
        required: true
    },
    reply_to_name:{//目标评论的用户名
        type: String,
        required: true
    },

    reply_content: {//回复内容
        type: String,
        required: true
    },

    reply_like: {//点赞数量
        type: Number,
        required: true
    },

    reply_oppose: {//反对数量
        type: Number,
        required: true
    }
    
})

module.exports = mongoose.model('replyCommit', replySchema)